package com.sky.mapper;


import com.sky.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;

@Mapper
public interface UserMapper {


    @Select("SELECT * FROM sys_user WHERE username = #{username}")
    User findByUsername(String username);

    @Insert("insert into sys_user(username,password,create_time,update_time) values(#{username},#{password},#{createTime},#{updateTime})")
    void insert(String username, String password, LocalDateTime createTime, LocalDateTime updateTime);

    void update(User user);


    @Update("update sys_user set password = #{string}, update_time = now() where id = #{id}")
    void updatePassword(String string, Integer id);
}
